type MyMethodDecoratorType = (
  targetClassPrototype: any,
  methodName: string,
  methodDescr: PropertyDescriptor
) => void;

export function get(reqPath: string): MyMethodDecoratorType {
  return (targetClassPrototype, methodName, methodDescr) => {
    /**
     * path: 元数据key
     * reqPath: 元数据值
     * args[2, 3]: 想把设置的数据放到哪（目标）放到原型的方法上
     */
    Reflect.defineMetadata('path', reqPath, targetClassPrototype, methodName);

    console.log('方法装饰器执行', reqPath, targetClassPrototype, methodName);
  };
}

export function RequestMethodDecorator(reqPath: string): MyMethodDecoratorType {
  return (targetClassPrototype, methodName, methodDescr) => {
    /**
     * 在当前装饰器修饰的方法上添加一个元数据
     *
     * key是：'path'
     * 值是：reqPath
     * 将值放到哪：原型的方法上 targetClassPrototype.methodName
     */
    Reflect.defineMetadata('path', reqPath, targetClassPrototype, methodName);
  };
}
